import {applyMiddleware, createStore} from "redux";
import {thunk} from 'redux-thunk'
import reduxPromise from 'redux-promise'
import reduxLogger from 'redux-logger'
import reducer from "@/store/reducer/index.js";

let middleware = [thunk, reduxPromise],
    env = import.meta.env.MODE
if (env === 'development') {
    middleware.push(reduxLogger)
}
const store = createStore(
    reducer,
    applyMiddleware(...middleware)
)

export default store